Guest User

Untitled

a guest
Aug 14th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.76 KB | None | 0 0
  1. 10-23 10:18:18.945: E/AndroidRuntime(8987): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4. package="xxxxx.android.phone.xxxxx"
  5. android:versionCode="3"
  6. android:versionName="v1.2.4065" >
  7.  
  8. <uses-sdk android:minSdkVersion="12"
  9. android:targetSdkVersion="21" />
  10.  
  11. <!-- Required for Google Analytics -->
  12. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  13.  
  14. <!-- For push notifications (GCM) -->
  15. <permission android:name="xxxxx.android.phone.xxxxx.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  16. <uses-permission android:name="xxxxx.android.phone.xxxxx.permission.C2D_MESSAGE" />
  17. <!-- App receives GCM messages. -->
  18. <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  19. <!-- GCM connects to Google Services. -->
  20. <uses-permission android:name="android.permission.INTERNET" />
  21. <!-- GCM requires a Google account. -->
  22. <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  23. <!-- Keeps the processor from sleeping when a message is received. -->
  24. <uses-permission android:name="android.permission.WAKE_LOCK" />
  25. <!-- GCM - We handle notifications differently if the app is running -->
  26. <uses-permission android:name="android.permission.GET_TASKS" />
  27.  
  28. <!-- Caching -->
  29. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  30.  
  31. <!-- The event subscribe button adds events to the calendar -->
  32. <!-- <uses-permission android:name="android.permission.WRITE_CALENDAR" /> -->
  33. <!-- <uses-permission android:name="android.permission.READ_CALENDAR" /> -->
  34.  
  35. <supports-screens
  36. android:resizeable="true"
  37. android:smallScreens="false"
  38. android:normalScreens="true"
  39. android:largeScreens="true"
  40. android:xlargeScreens="true"
  41. android:anyDensity="true" />
  42.  
  43. <application
  44. android:name="xxxxx.xxxxxApplication"
  45. android:icon="@drawable/app_icon"
  46. android:label="@string/app_name"
  47. android:allowBackup="true"
  48. android:largeHeap="true" >
  49. <receiver
  50. android:name="com.google.android.gcm.GCMBroadcastReceiver"
  51. android:permission="com.google.android.c2dm.permission.SEND" >
  52. <intent-filter>
  53. <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  54. <category android:name="xxxxx.android.phone.xxxxx" />
  55. </intent-filter>
  56. <intent-filter>
  57. <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  58. <category android:name="xxxxx.android.phone.xxxxx" />
  59. </intent-filter>
  60. </receiver>
  61.  
  62. <receiver
  63. android:name="xxxxx.ConnectivityReceiver"
  64. android:enabled="false" >
  65. <intent-filter>
  66. <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
  67. </intent-filter>
  68. </receiver>
  69.  
  70. <activity
  71. android:name=".SplashActivity"
  72. android:configChanges="locale|orientation"
  73. android:theme="@style/Theme.Splash"
  74. android:screenOrientation="portrait"
  75. android:noHistory="true" >
  76. <intent-filter >
  77. <action android:name="android.intent.action.MAIN" />
  78. <category android:name="android.intent.category.LAUNCHER" />
  79. </intent-filter>
  80. </activity>
  81. <activity
  82. android:label="@string/app_name"
  83. android:theme="@style/Theme"
  84. android:windowSoftInputMode="adjustPan|stateVisible"
  85. android:name=".LoginActivity"
  86. android:configChanges="locale|orientation|screenSize"
  87. android:screenOrientation="portrait" >
  88. </activity>
  89. <activity
  90. android:name=".MainActivity"
  91. android:theme="@style/Theme"
  92. android:configChanges="locale|orientation|screenSize"
  93. android:screenOrientation="portrait"
  94. android:windowSoftInputMode="adjustPan|stateVisible" />
  95.  
  96. <activity
  97. android:name=".CountryPickerActivity"
  98. android:theme="@style/Theme.Floating"
  99. android:configChanges="locale|orientation|screenSize"
  100. android:screenOrientation="portrait"
  101. android:windowSoftInputMode="adjustPan|stateVisible" />
  102. <activity
  103. android:name=".EventPickerActivity"
  104. android:theme="@style/Theme.Floating"
  105. android:configChanges="locale|orientation|screenSize"
  106. android:screenOrientation="portrait"
  107. android:windowSoftInputMode="adjustPan|stateVisible" />
  108. <activity
  109. android:name=".TutorialActivity"
  110. android:theme="@style/Theme.Transparent"
  111. android:configChanges="locale|orientation|screenSize"
  112. android:screenOrientation="portrait" />
  113.  
  114. <activity
  115. android:name=".VideoPlayerActivity"
  116. android:theme="@style/Theme"
  117. android:configChanges="orientation|screenSize" />
  118.  
  119. <service android:name=".GCMIntentService" android:enabled="true" />
  120. <meta-data android:name="com.crashlytics.ApiKey" android:value="xxxxxxxxxxxxxxxx"/>
  121. </application>
  122.  
  123. </manifest>
  124.  
  125. public class GCMIntentService extends GCMBaseIntentService {
  126. private static final int ATTEMPTS_MAX = 3;
  127.  
  128. final static boolean USE_DEV = false;
  129. final static String XXXXX = "https://xxxxx/api.php";
  130. final static String XXXXX = "http://dev.xxxxx/api.php";
  131. final static String SUBSCRIPTION_KEY = "xxxxxxxxxxxxxxx"; // unique per app
  132.  
  133. public GCMIntentService() {
  134. super(xxxxxx.SENDER_ID);
  135. if(GCMIntentService.USE_DEV) {
  136. host = XXXXX;
  137. } else {
  138. host = XXXXX;
  139. }
  140. }
  141.  
  142. ...
  143.  
  144. }
  145.  
  146. 10-23 13:17:08.095: E/AndroidRuntime(10560): FATAL EXCEPTION: GAThread
  147. 10-23 13:17:08.095: E/AndroidRuntime(10560): Process: xxxxx.android.phone.xxxxx, PID: 10560
  148. 10-23 13:17:08.095: E/AndroidRuntime(10560): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }
  149. 10-23 13:17:08.095: E/AndroidRuntime(10560): at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
  150. 10-23 13:17:08.095: E/AndroidRuntime(10560): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
  151. 10-23 13:17:08.095: E/AndroidRuntime(10560): at android.app.ContextImpl.bindService(ContextImpl.java:1751)
  152. 10-23 13:17:08.095: E/AndroidRuntime(10560): at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
  153. 10-23 13:17:08.095: E/AndroidRuntime(10560): at com.google.analytics.tracking.android.AnalyticsGmsCoreClient.connect(AnalyticsGmsCoreClient.java:82)
  154. 10-23 13:17:08.095: E/AndroidRuntime(10560): at com.google.analytics.tracking.android.GAServiceProxy.connectToService(GAServiceProxy.java:279)
  155. 10-23 13:17:08.095: E/AndroidRuntime(10560): at com.google.analytics.tracking.android.GAServiceProxy.createService(GAServiceProxy.java:163)
  156. 10-23 13:17:08.095: E/AndroidRuntime(10560): at com.google.analytics.tracking.android.GAThread.init(GAThread.java:95)
  157. 10-23 13:17:08.095: E/AndroidRuntime(10560): at com.google.analytics.tracking.android.GAThread.run(GAThread.java:493)
  158.  
  159. // explicit Intent, safe
  160. Intent serviceIntent = new Intent(ILicensingService.class.getName());
  161. serviceIntent.setPackage("com.android.vending");
  162. boolean bindResult = mContext.bindService(serviceIntent, this, Context.BIND_AUTO_CREATE);
  163.  
  164. com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
  165.  
  166. new String(
  167. - Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
  168. + Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))
  169. + .setPackage("com.android.vending"), // this fix the 'IllegalArgumentException: Service Intent must be explicit'
  170. this, // ServiceConnection.
  171.  
  172. Intent startIntent = new Intent(this, ServiceToStart.class);
  173. this.startService(startIntent); // or bindService(...)
  174.  
  175. public static Intent createExplicitFromImplicitIntent(Context context, Intent implicitIntent) {
  176. //Retrieve all services that can match the given intent
  177. PackageManager pm = context.getPackageManager();
  178. List<ResolveInfo> resolveInfo = pm.queryIntentServices(implicitIntent, 0);
  179.  
  180. //Make sure only one match was found
  181. if (resolveInfo == null || resolveInfo.size() != 1) {
  182. return null;
  183. }
  184.  
  185. //Get component info and create ComponentName
  186. ResolveInfo serviceInfo = resolveInfo.get(0);
  187. String packageName = serviceInfo.serviceInfo.packageName;
  188. String className = serviceInfo.serviceInfo.name;
  189. ComponentName component = new ComponentName(packageName, className);
  190.  
  191. //Create a new intent. Use the old one for extras and such reuse
  192. Intent explicitIntent = new Intent(implicitIntent);
  193.  
  194. //Set the component to be explicit
  195. explicitIntent.setComponent(component);
  196.  
  197. return explicitIntent;
  198. }
  199.  
  200. Intent serviceIntent = new Intent(new String(
  201. Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
  202.  
  203. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
  204. serviceIntent.setPackage("com.android.vending");
  205. }
  206.  
  207. boolean bindResult =
  208. mContext.bindService(
  209. serviceIntent,
  210. this, // ServiceConnection.
  211. Context.BIND_AUTO_CREATE);
  212.  
  213. Intent intent = new Intent(this, Class.forName(ServiceClassName.class.getName()));
  214. bindService(intent,serviceConnection, Service.BIND_AUTO_CREATE);
  215.  
  216. var intent = new Intent (this,typeof(MyBoundService));
  217. var serviceConnection = new MyBindServiceConnection (this);
  218. BindService (intent, serviceConnection, Bind.AutoCreate);
Add Comment
Please, Sign In to add comment