{"_id":"597aaea11e91c7001bd19a2c","project":"57170dacd2a6510e008408f9","version":{"_id":"57170dacd2a6510e008408fc","hasDoc":true,"hasReference":true,"project":"57170dacd2a6510e008408f9","__v":2,"createdAt":"2016-04-20T05:03:40.116Z","releaseDate":"2016-04-20T05:03:40.116Z","categories":["57170dacd2a6510e008408fd","571717cefdcb310e00f23e49"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"57170dacd2a6510e008408fd","project":"57170dacd2a6510e008408f9","__v":0,"version":"57170dacd2a6510e008408fc","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-04-20T05:03:40.137Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"user":"57170e372be45f0e00caae4f","githubsync":"","__v":1,"parentDoc":null,"updates":["5a27f6efeaec590012c55021"],"next":{"pages":[],"description":""},"createdAt":"2017-07-28T03:25:21.813Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"These are the step-by-step procedures to integrate an application with the Dialog EULA\n\n1. Ensure that you register your application.\n2. After the registration click the download button and a popup will appear\n3. Choose Bundled option and wait for the generated sdk zipped named market-sdk.zip to be downloaded.\n4. Once downloaded, unzip the file and upon unzipping copy the market-sdk-2.1.0.jar file\nand paste to your project libs folder\n5. Import all the pertinent classes and interface on the Main Activity of the application.\n6. Declare a private variable for IMarketPartner interface.\n7. Invoke setPartnerEulaType method and set the value to IMarketPartner.EULA.DIALOG, which will allow MOBI classes/services to determine what type of EULA to use.\n8. Use the following code snippets to validate whether EULA is shown or accepted and user is not blacklisted using an instance of MarketPartner interface:\n*marketPartner.isEulaShown() - Checks the status of the EULA.\nmarketPartner.isEulaAccepted() - Status if end-user already accepted or declined EULA.\nmarketPartner.isBlacklisted() - To ensure not to show EULA or start any services if end-user was blacklisted.*\n9. Add all applicable permissions on your AndroidManifest.xml file.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Import Mobi.Info partner interfaces and classes\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"//In your project, open the Main Activity of the application and import all pertinent classes and interfaces as shown below:\\n\\nimport com.cf.iie.partner.IMarketPartner;\\n\\nimport com.cf.iie.partner.MarketPartner;\\n\\n//Declare a private variable for IMarketPartner interface.\\n\\nprivate IMarketPartner marketPartner = null;\\n\\n//Instantiate the MarketPartner.Builder on android Activity onCreate method:\\n//Invoke setPartnerEulaType method and set the value to IMarketPartner.EULA.DIALOG, which will allow MOBI classes/services to determine what type of EULA to use.\\n\\n:::at:::Override\\nprotected void onCreate(Bundle savedInstanceState) {\\n  \\nsuper.onCreate(savedInstanceState);\\n  \\nsetContentView(R.layout.activity_main);\\n                \\nmarketPartner = new MarketPartner.Builder(MainActivity.this)\\n\\n.setPartnerEulaType(IMarketPartner.EULA.DIALOG)                                                                       \\n                                                                        \\n//Optional if only you wish to add additional information to be transmitted to the MOBI server for example\\n//Your own appid or any identifier which you think useful for future log checking\\n.addIntegrationData(\\\"test_key_1\\\",\\\"data you wish to add\\\")\\n\\n.addIntegrationData(\\\"test_key_2\\\",\\\"data you wish to add\\\")\\n  \\n.build();                                    \\n\\n\\n                                                                        \\n}\\n\\n//Use the following code snippets to validate whether EULA is shown or accepted and user is not blacklisted using an instance of MarketPartner interface\\n\\n//marketPartner.isEulaShown() - Checks the status of the EULA.\\n//marketPartner.isEulaAccepted() - Status if end-user already accepted or declined EULA.\\n//marketPartner.isBlacklisted() - To ensure not to show EULA or start any services if end-user was blacklisted.\\n\\npublic class MainActivity extends AppCompatActivity  \\n\\nprivate Handler eulaHandler = new EulaHandler();\\n\\nprivate IMarketPartner marketPartner = null;    \\n        \\n@Override\\nprotected void onCreate(Bundle savedInstanceState) {\\n          \\nsuper.onCreate(savedInstanceState);\\n          \\nsetContentView(R.layout.activity_main);\\n                        \\nmarketPartner = new MarketPartner.Builder(MainActivity.this)\\n  \\n.setPartnerEulaType(IMarketPartner.EULA.DIALOG)                                                        \\n                                                        \\n//Optional if only you wish to add additional information to be transmitted to the MOBI server for example\\n//Your own appid or any identifier which you think useful for future log checking\\n.addIntegrationData(\\\"test_key_1\\\",\\\"data you wish to add\\\")\\n  \\n.addIntegrationData(\\\"test_key_2\\\",\\\"data you wish to add\\\")\\n\\n.build();    \\n\\n                                                                             \\nif(!marketPartner.isEulaShown() && !marketPartner.isEulaAccepted() &&\\n !marketPartner.isBlacklisted()){      \\n  \\n//Invoke/Show custom AlertDialog Eula Here   \\neulaHandler.sendEmptyMessage(1);\\n  \\n/***\\nYou may also use Activity runOnUiThread if you prefer.\\nMainActivity.runOnUiThread(new Runnable() {\\n\\n@Override\\npublic void run() {\\n      // Your EULA AlertDialog code Here\\n    \\n    }\\n   \\n   });\\n  \\n  */\\n }else{     \\n  \\n\\n  marketPartner.start();\\n  \\n\\n}\\n}\\n        \\n        \\nclass EulaHandler extends Handler {\\n  \\n @Override\\npublic void handleMessage(Message msg) {\\n  \\nAlertDialog.Builder alertBuilder = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, android.R.style.Theme_Dialog));\\n  \\nalertBuilder.setTitle(\\\"Your EULA Title Here\\\");\\n\\nalertBuilder.setCancelable(false);\\n\\nalertBuilder.setPositiveButton(decline,new Dialog.OnClickListener() {\\n  \\n@Override\\npublic void onClick(DialogInterface dialog, int which) {\\n  \\nmarketPartner.onEulaAccepted();\\n  \\n }\\n});\\n\\nalertBuilder.setNegativeButton(accept,new Dialog.OnClickListener() {\\n  \\n@Override\\npublic void onClick(DialogInterface dialog, int which) {\\n  \\nmarketPartner.onEulaDeclined();\\n\\n}\\n});\\n\\nAlertDialog dialog = alertBuilder.create();\\n\\nWebView wv = new WebView(MainActivity.this);\\n\\nwv.loadData(\\\"Your EULA Info Here\\\", \\\"text/html\\\", \\\"UTF-8\\\");\\n  \\nwv.setScrollbarFadingEnabled(false);\\n\\ndialog.setView(wv);\\n  \\ndialog.show();\\n\\nWindowManager.LayoutParams lp = new WindowManager.LayoutParams();\\n  \\nlp.copyFrom(dialog.getWindow().getAttributes());\\n  \\nlp.width = WindowManager.LayoutParams.MATCH_PARENT;\\n  \\nlp.height = WindowManager.LayoutParams.MATCH_PARENT;\\n  \\ndialog.getWindow().setAttributes(lp);\\n  \\n}\\n  \\n}\\n\\n}\\n\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"import android.os.Bundle;\\nimport android.support.v7.app.AppCompatActivity;\\nimport android.view.Menu;\\nimport android.view.MenuItem;\\nimport com.test.IMarket;\\nimport com.test.IMarketDialogStatusListener;\\nimport com.test.Market;\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Adjust AndroidManifest.xml To Unlock The Necessary User-Permissions\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<uses-permission android:name=\\\"android.permission.INTERNET\\\" />\\n<uses-permission android:name=\\\"android.permission.ACCESS_NETWORK_STATE\\\" />\\n<uses-permission android:name=\\\"android.permission.RECEIVE_BOOT_COMPLETED\\\" />\\n<uses-permission android:name=\\\"android.permission.READ_PHONE_STATE\\\" />\\n<uses-permission android:name=\\\"android.permission.GET_ACCOUNTS\\\" />\\n<uses-permission android:name=\\\"com.android.browser.permission.READ_HISTORY_BOOKMARKS\\\" />\\n<uses-permission android:name=\\\"android.permission.ACCESS_FINE_LOCATION\\\" />\\n<uses-permission android:name=\\\"android.permission.BLUETOOTH\\\" />\\n<uses-permission android:name=\\\"android.permission.BLUETOOTH_ADMIN\\\" />\\n<uses-permission android:name=\\\"com.google.android.gms.permission.ACTIVITY_RECOGNITION\\\" />\\n\\t  \\t\\n    \",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Specify Required Dependencies\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"dependencies {\\n        compile files('libs/market-sdk-2.1.0.jar')\\n        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', \\n        {\\n                exclude group: 'com.android.support', module: 'support-annotations'\\n        })\\n        compile 'com.android.support:appcompat-v7:25.3.1'\\n        compile 'com.android.support.constraint:constraint-layout:1.0.2'  \\n                \\n        compile 'org.altbeacon:android-beacon-library:2.7'\\n        compile 'com.google.android.gms:play-services-location:9.8.0'\\n        compile 'com.google.android.gms:play-services-ads:9.8.0'\\n}\\n\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Specify Required Services,Receivers and Activity\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"within <application>:\\n\\n<service android:name=\\\"com.cf.iie.MarketService\\\" android:exported=\\\"false\\\"/>\\n<service android:name=\\\"com.cf.iie.MarketBeaconService\\\" android:enabled=\\\"true\\\" android:exported=\\\"false\\\" >\\n\\n<activity android:name=\\\"com.cf.iie.MarketEula\\\"  android:theme=\\\"@android:style/Theme.Dialog\\\"  >\\n\\t\\t<intent-filter>\\n\\t\\t\\t<action android:name=\\\"com.cf.iie.action.START_EULA\\\" >\\n\\t\\t\\t<category android:name=\\\"android.intent.category.DEFAULT\\\" >\\n\\t\\t</intent-filter>\\n</activity>\\n\\n<receiver android:name=\\\"com.cf.iie.MarketBootReceiver\\\" >\\n\\t\\t<intent-filter>\\n\\t\\t\\t<action android:name=\\\"android.intent.action.BOOT_COMPLETED\\\" >\\n\\t\\t</intent-filter>\\n</receiver>\\n\\n<receiver android:name=\\\"com.cf.iie.MarketConnectivityChange\\\"  android:enabled=\\\"true\\\"     android:exported=\\\"true\\\">\\n\\t\\t<intent-filter>\\n\\t\\t\\t<action android:name=\\\"android.net.conn.CONNECTIVITY_CHANGE\\\">\\n\\t\\t</intent-filter>\\n</receiver>\\n\\n<service\\n\\tandroid:name=\\\"org.altbeacon.beacon.service.BeaconService\\\"\\n\\tandroid:enabled=\\\"true\\\"\\n\\tandroid:exported=\\\"false\\\"\\n\\tandroid:isolatedProcess=\\\"false\\\"\\n\\tandroid:label=\\\"beacon\\\" />\\n\\n<service\\n\\tandroid:name=\\\"org.altbeacon.beacon.BeaconIntentProcessor\\\"\\n\\tandroid:enabled=\\\"true\\\"\\n\\tandroid:exported=\\\"false\\\" />\\n\\t\\n<receiver android:name=\\\"org.altbeacon.beacon.startup.StartupBroadcastReceiver\\\">\\n\\t\\t<intent-filter>\\n\\t\\t\\t<action android:name=\\\"android.intent.action.BOOT_COMPLETED\\\" />\\n\\t\\t\\t<action android:name=\\\"android.intent.action.ACTION_POWER_CONNECTED\\\" />\\n\\t\\t\\t<action android:name=\\\"android.intent.action.ACTION_POWER_DISCONNECTED\\\"/>\\n\\t\\t</intent-filter>\\n</receiver>\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"A sample of the AndroidManifest.xml file in its entirety\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n<manifest\\n\\txmlns:android=\\\"http://schemas.android.com/apk/res/android\\\"\\n\\t  package=\\\"com.market.demo\\\"\\n\\t  android:versionCode=\\\"1\\\"\\n\\t  android:versionName=\\\"1.0\\\" >\\n\\t<uses-sdk\\n\\t\\t  android:minSdkVersion=\\\"9\\\"\\n\\t\\t  android:targetSdkVersion=\\\"24\\\" />\\n\\n\\t<uses-permission android:name=\\\"android.permission.INTERNET\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.ACCESS_NETWORK_STATE\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.RECEIVE_BOOT_COMPLETED\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.READ_PHONE_STATE\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.GET_ACCOUNTS\\\" />\\n\\t<uses-permission android:name=\\\"com.android.browser.permission.READ_HISTORY_BOOKMARKS\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.ACCESS_FINE_LOCATION\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.BLUETOOTH\\\" />\\n\\t<uses-permission android:name=\\\"android.permission.BLUETOOTH_ADMIN\\\" />\\n\\t<uses-permission android:name=\\\"com.google.android.gms.permission.ACTIVITY_RECOGNITION\\\" />\\n\\t\\n\\t<application\\n\\t\\t\\t\\t android:allowBackup=\\\"true\\\"\\n\\t\\t\\t\\t android:theme=\\\"@style/AppTheme\\\" >\\n\\t\\t<meta-data android:name=\\\"com.google.android.gms.version\\\"\\n\\t\\t\\t\\t android:value=\\\"@integer/google_play_services_version\\\" />\\n    \\n\\t\\t<activity\\n\\t\\t\\t\\tandroid:name=\\\".SplashScreen\\\"\\n\\t\\t\\t\\tandroid:label=\\\"@string/app_name\\\" >\\n\\t\\t\\t<intent-filter>\\n\\t\\t\\t  <action android:name=\\\"android.intent.action.MAIN\\\" />\\n\\t\\t\\t  <category android:name=\\\"android.intent.category.LAUNCHER\\\" />\\n\\t\\t\\t</intent-filter>\\n\\t\\t</activity>\\n\\t\\t\\n\\t\\t<activity android:name=\\\".MainActivity\\\"  android:label=\\\"@string/app_name\\\" />\\n\\t\\t<service android:name=\\\"com.cf.iie.MarketService\\\" android:exported=\\\"false\\\"/>\\n\\t\\t<service android:name=\\\"com.cf.iie.MarketBeaconService\\\" android:enabled=\\\"true\\\" android:exported=\\\"false\\\" >\\n\\n\\t\\t<activity android:name=\\\"com.cf.iie.MarketEula\\\"  android:theme=\\\"@android:style/Theme.Dialog\\\"  >\\n\\t\\t\\t<intent-filter>\\n\\t\\t\\t\\t<action android:name=\\\"com.cf.iie.action.START_EULA\\\" >\\n\\t\\t\\t\\t<category android:name=\\\"android.intent.category.DEFAULT\\\" >\\n\\t\\t\\t</intent-filter>\\n\\t\\t</activity>\\n\\n\\t\\t<receiver android:name=\\\"com.cf.iie.MarketBootReceiver\\\" >\\n\\t\\t\\t<intent-filter>\\n\\t\\t\\t\\t<action android:name=\\\"android.intent.action.BOOT_COMPLETED\\\" >\\n\\t\\t\\t</intent-filter>\\n\\t\\t</receiver>\\n\\n\\t\\t<receiver android:name=\\\"com.cf.iie.MarketConnectivityChange\\\"  android:enabled=\\\"true\\\"     android:exported=\\\"true\\\">\\n\\t\\t\\t<intent-filter>\\n\\t\\t\\t\\t<action android:name=\\\"android.net.conn.CONNECTIVITY_CHANGE\\\">\\n\\t\\t\\t</intent-filter>\\n\\t\\t</receiver>\\n\\n\\t\\t<service\\n\\t\\t\\tandroid:name=\\\"org.altbeacon.beacon.service.BeaconService\\\"\\n\\t\\t\\tandroid:enabled=\\\"true\\\"\\n\\t\\t\\tandroid:exported=\\\"false\\\"\\n\\t\\t\\tandroid:isolatedProcess=\\\"false\\\"\\n\\t\\t\\tandroid:label=\\\"beacon\\\" />\\n\\t\\t\\n\\t\\t<service\\n\\t\\t\\tandroid:name=\\\"org.altbeacon.beacon.BeaconIntentProcessor\\\"\\n\\t\\t\\tandroid:enabled=\\\"true\\\"\\n\\t\\t\\tandroid:exported=\\\"false\\\" />\\n\\t\\t\\t\\n\\t\\t<receiver android:name=\\\"org.altbeacon.beacon.startup.StartupBroadcastReceiver\\\">\\n\\t\\t\\t<intent-filter>\\n\\t\\t\\t\\t<action android:name=\\\"android.intent.action.BOOT_COMPLETED\\\" />\\n\\t\\t\\t\\t<action android:name=\\\"android.intent.action.ACTION_POWER_CONNECTED\\\" />\\n\\t\\t\\t\\t<action android:name=\\\"android.intent.action.ACTION_POWER_DISCONNECTED\\\"/>\\n\\t\\t\\t</intent-filter>\\n\\t\\t</receiver>\\n\\n\\t</application>\\n</manifest>\\n\\n\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","excerpt":"This page will help you get started with Dialog EULA Integration. To use this documentation accordingly a publisher MUST be a registered mobi partner otherwise it will be for naught.","slug":"dialog-eula-integration","type":"basic","title":"Dialog EULA Integration"}

Dialog EULA Integration

This page will help you get started with Dialog EULA Integration. To use this documentation accordingly a publisher MUST be a registered mobi partner otherwise it will be for naught.

These are the step-by-step procedures to integrate an application with the Dialog EULA 1. Ensure that you register your application. 2. After the registration click the download button and a popup will appear 3. Choose Bundled option and wait for the generated sdk zipped named market-sdk.zip to be downloaded. 4. Once downloaded, unzip the file and upon unzipping copy the market-sdk-2.1.0.jar file and paste to your project libs folder 5. Import all the pertinent classes and interface on the Main Activity of the application. 6. Declare a private variable for IMarketPartner interface. 7. Invoke setPartnerEulaType method and set the value to IMarketPartner.EULA.DIALOG, which will allow MOBI classes/services to determine what type of EULA to use. 8. Use the following code snippets to validate whether EULA is shown or accepted and user is not blacklisted using an instance of MarketPartner interface: *marketPartner.isEulaShown() - Checks the status of the EULA. marketPartner.isEulaAccepted() - Status if end-user already accepted or declined EULA. marketPartner.isBlacklisted() - To ensure not to show EULA or start any services if end-user was blacklisted.* 9. Add all applicable permissions on your AndroidManifest.xml file. [block:api-header] { "type": "basic", "title": "Import Mobi.Info partner interfaces and classes" } [/block] [block:code] { "codes": [ { "code": "//In your project, open the Main Activity of the application and import all pertinent classes and interfaces as shown below:\n\nimport com.cf.iie.partner.IMarketPartner;\n\nimport com.cf.iie.partner.MarketPartner;\n\n//Declare a private variable for IMarketPartner interface.\n\nprivate IMarketPartner marketPartner = null;\n\n//Instantiate the MarketPartner.Builder on android Activity onCreate method:\n//Invoke setPartnerEulaType method and set the value to IMarketPartner.EULA.DIALOG, which will allow MOBI classes/services to determine what type of EULA to use.\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n \nsuper.onCreate(savedInstanceState);\n \nsetContentView(R.layout.activity_main);\n \nmarketPartner = new MarketPartner.Builder(MainActivity.this)\n\n.setPartnerEulaType(IMarketPartner.EULA.DIALOG) \n \n//Optional if only you wish to add additional information to be transmitted to the MOBI server for example\n//Your own appid or any identifier which you think useful for future log checking\n.addIntegrationData(\"test_key_1\",\"data you wish to add\")\n\n.addIntegrationData(\"test_key_2\",\"data you wish to add\")\n \n.build(); \n\n\n \n}\n\n//Use the following code snippets to validate whether EULA is shown or accepted and user is not blacklisted using an instance of MarketPartner interface\n\n//marketPartner.isEulaShown() - Checks the status of the EULA.\n//marketPartner.isEulaAccepted() - Status if end-user already accepted or declined EULA.\n//marketPartner.isBlacklisted() - To ensure not to show EULA or start any services if end-user was blacklisted.\n\npublic class MainActivity extends AppCompatActivity \n\nprivate Handler eulaHandler = new EulaHandler();\n\nprivate IMarketPartner marketPartner = null; \n \n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n \nsuper.onCreate(savedInstanceState);\n \nsetContentView(R.layout.activity_main);\n \nmarketPartner = new MarketPartner.Builder(MainActivity.this)\n \n.setPartnerEulaType(IMarketPartner.EULA.DIALOG) \n \n//Optional if only you wish to add additional information to be transmitted to the MOBI server for example\n//Your own appid or any identifier which you think useful for future log checking\n.addIntegrationData(\"test_key_1\",\"data you wish to add\")\n \n.addIntegrationData(\"test_key_2\",\"data you wish to add\")\n\n.build(); \n\n \nif(!marketPartner.isEulaShown() && !marketPartner.isEulaAccepted() &&\n !marketPartner.isBlacklisted()){ \n \n//Invoke/Show custom AlertDialog Eula Here \neulaHandler.sendEmptyMessage(1);\n \n/***\nYou may also use Activity runOnUiThread if you prefer.\nMainActivity.runOnUiThread(new Runnable() {\n\n@Override\npublic void run() {\n // Your EULA AlertDialog code Here\n \n }\n \n });\n \n */\n }else{ \n \n\n marketPartner.start();\n \n\n}\n}\n \n \nclass EulaHandler extends Handler {\n \n @Override\npublic void handleMessage(Message msg) {\n \nAlertDialog.Builder alertBuilder = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, android.R.style.Theme_Dialog));\n \nalertBuilder.setTitle(\"Your EULA Title Here\");\n\nalertBuilder.setCancelable(false);\n\nalertBuilder.setPositiveButton(decline,new Dialog.OnClickListener() {\n \n@Override\npublic void onClick(DialogInterface dialog, int which) {\n \nmarketPartner.onEulaAccepted();\n \n }\n});\n\nalertBuilder.setNegativeButton(accept,new Dialog.OnClickListener() {\n \n@Override\npublic void onClick(DialogInterface dialog, int which) {\n \nmarketPartner.onEulaDeclined();\n\n}\n});\n\nAlertDialog dialog = alertBuilder.create();\n\nWebView wv = new WebView(MainActivity.this);\n\nwv.loadData(\"Your EULA Info Here\", \"text/html\", \"UTF-8\");\n \nwv.setScrollbarFadingEnabled(false);\n\ndialog.setView(wv);\n \ndialog.show();\n\nWindowManager.LayoutParams lp = new WindowManager.LayoutParams();\n \nlp.copyFrom(dialog.getWindow().getAttributes());\n \nlp.width = WindowManager.LayoutParams.MATCH_PARENT;\n \nlp.height = WindowManager.LayoutParams.MATCH_PARENT;\n \ndialog.getWindow().setAttributes(lp);\n \n}\n \n}\n\n}\n", "language": "java" }, { "code": "import android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport com.test.IMarket;\nimport com.test.IMarketDialogStatusListener;\nimport com.test.Market;", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Adjust AndroidManifest.xml To Unlock The Necessary User-Permissions" } [/block] [block:code] { "codes": [ { "code": "<uses-permission android:name=\"android.permission.INTERNET\" />\n<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />\n<uses-permission android:name=\"android.permission.GET_ACCOUNTS\" />\n<uses-permission android:name=\"com.android.browser.permission.READ_HISTORY_BOOKMARKS\" />\n<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />\n<uses-permission android:name=\"android.permission.BLUETOOTH\" />\n<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />\n<uses-permission android:name=\"com.google.android.gms.permission.ACTIVITY_RECOGNITION\" />\n\t \t\n ", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Specify Required Dependencies" } [/block] [block:code] { "codes": [ { "code": "dependencies {\n compile files('libs/market-sdk-2.1.0.jar')\n androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', \n {\n exclude group: 'com.android.support', module: 'support-annotations'\n })\n compile 'com.android.support:appcompat-v7:25.3.1'\n compile 'com.android.support.constraint:constraint-layout:1.0.2' \n \n compile 'org.altbeacon:android-beacon-library:2.7'\n compile 'com.google.android.gms:play-services-location:9.8.0'\n compile 'com.google.android.gms:play-services-ads:9.8.0'\n}\n\n", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Specify Required Services,Receivers and Activity" } [/block] [block:code] { "codes": [ { "code": "within <application>:\n\n<service android:name=\"com.cf.iie.MarketService\" android:exported=\"false\"/>\n<service android:name=\"com.cf.iie.MarketBeaconService\" android:enabled=\"true\" android:exported=\"false\" >\n\n<activity android:name=\"com.cf.iie.MarketEula\" android:theme=\"@android:style/Theme.Dialog\" >\n\t\t<intent-filter>\n\t\t\t<action android:name=\"com.cf.iie.action.START_EULA\" >\n\t\t\t<category android:name=\"android.intent.category.DEFAULT\" >\n\t\t</intent-filter>\n</activity>\n\n<receiver android:name=\"com.cf.iie.MarketBootReceiver\" >\n\t\t<intent-filter>\n\t\t\t<action android:name=\"android.intent.action.BOOT_COMPLETED\" >\n\t\t</intent-filter>\n</receiver>\n\n<receiver android:name=\"com.cf.iie.MarketConnectivityChange\" android:enabled=\"true\" android:exported=\"true\">\n\t\t<intent-filter>\n\t\t\t<action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\">\n\t\t</intent-filter>\n</receiver>\n\n<service\n\tandroid:name=\"org.altbeacon.beacon.service.BeaconService\"\n\tandroid:enabled=\"true\"\n\tandroid:exported=\"false\"\n\tandroid:isolatedProcess=\"false\"\n\tandroid:label=\"beacon\" />\n\n<service\n\tandroid:name=\"org.altbeacon.beacon.BeaconIntentProcessor\"\n\tandroid:enabled=\"true\"\n\tandroid:exported=\"false\" />\n\t\n<receiver android:name=\"org.altbeacon.beacon.startup.StartupBroadcastReceiver\">\n\t\t<intent-filter>\n\t\t\t<action android:name=\"android.intent.action.BOOT_COMPLETED\" />\n\t\t\t<action android:name=\"android.intent.action.ACTION_POWER_CONNECTED\" />\n\t\t\t<action android:name=\"android.intent.action.ACTION_POWER_DISCONNECTED\"/>\n\t\t</intent-filter>\n</receiver>", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "A sample of the AndroidManifest.xml file in its entirety" } [/block] [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest\n\txmlns:android=\"http://schemas.android.com/apk/res/android\"\n\t package=\"com.market.demo\"\n\t android:versionCode=\"1\"\n\t android:versionName=\"1.0\" >\n\t<uses-sdk\n\t\t android:minSdkVersion=\"9\"\n\t\t android:targetSdkVersion=\"24\" />\n\n\t<uses-permission android:name=\"android.permission.INTERNET\" />\n\t<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n\t<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\n\t<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />\n\t<uses-permission android:name=\"android.permission.GET_ACCOUNTS\" />\n\t<uses-permission android:name=\"com.android.browser.permission.READ_HISTORY_BOOKMARKS\" />\n\t<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />\n\t<uses-permission android:name=\"android.permission.BLUETOOTH\" />\n\t<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />\n\t<uses-permission android:name=\"com.google.android.gms.permission.ACTIVITY_RECOGNITION\" />\n\t\n\t<application\n\t\t\t\t android:allowBackup=\"true\"\n\t\t\t\t android:theme=\"@style/AppTheme\" >\n\t\t<meta-data android:name=\"com.google.android.gms.version\"\n\t\t\t\t android:value=\"@integer/google_play_services_version\" />\n \n\t\t<activity\n\t\t\t\tandroid:name=\".SplashScreen\"\n\t\t\t\tandroid:label=\"@string/app_name\" >\n\t\t\t<intent-filter>\n\t\t\t <action android:name=\"android.intent.action.MAIN\" />\n\t\t\t <category android:name=\"android.intent.category.LAUNCHER\" />\n\t\t\t</intent-filter>\n\t\t</activity>\n\t\t\n\t\t<activity android:name=\".MainActivity\" android:label=\"@string/app_name\" />\n\t\t<service android:name=\"com.cf.iie.MarketService\" android:exported=\"false\"/>\n\t\t<service android:name=\"com.cf.iie.MarketBeaconService\" android:enabled=\"true\" android:exported=\"false\" >\n\n\t\t<activity android:name=\"com.cf.iie.MarketEula\" android:theme=\"@android:style/Theme.Dialog\" >\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"com.cf.iie.action.START_EULA\" >\n\t\t\t\t<category android:name=\"android.intent.category.DEFAULT\" >\n\t\t\t</intent-filter>\n\t\t</activity>\n\n\t\t<receiver android:name=\"com.cf.iie.MarketBootReceiver\" >\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"android.intent.action.BOOT_COMPLETED\" >\n\t\t\t</intent-filter>\n\t\t</receiver>\n\n\t\t<receiver android:name=\"com.cf.iie.MarketConnectivityChange\" android:enabled=\"true\" android:exported=\"true\">\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\">\n\t\t\t</intent-filter>\n\t\t</receiver>\n\n\t\t<service\n\t\t\tandroid:name=\"org.altbeacon.beacon.service.BeaconService\"\n\t\t\tandroid:enabled=\"true\"\n\t\t\tandroid:exported=\"false\"\n\t\t\tandroid:isolatedProcess=\"false\"\n\t\t\tandroid:label=\"beacon\" />\n\t\t\n\t\t<service\n\t\t\tandroid:name=\"org.altbeacon.beacon.BeaconIntentProcessor\"\n\t\t\tandroid:enabled=\"true\"\n\t\t\tandroid:exported=\"false\" />\n\t\t\t\n\t\t<receiver android:name=\"org.altbeacon.beacon.startup.StartupBroadcastReceiver\">\n\t\t\t<intent-filter>\n\t\t\t\t<action android:name=\"android.intent.action.BOOT_COMPLETED\" />\n\t\t\t\t<action android:name=\"android.intent.action.ACTION_POWER_CONNECTED\" />\n\t\t\t\t<action android:name=\"android.intent.action.ACTION_POWER_DISCONNECTED\"/>\n\t\t\t</intent-filter>\n\t\t</receiver>\n\n\t</application>\n</manifest>\n\n", "language": "xml" } ] } [/block]