Commit 722ce892 authored by Simon MacDonald's avatar Simon MacDonald
Browse files

Refactor Android package name

parent 2af0d686
Loading
Loading
Loading
Loading
+8 −8
Changes for plugin.xml: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@

		<config-file target="res/xml/config.xml" parent="/*">
			<feature name="PushNotification" >
				<param name="android-package" value="com.plugin.gcm.PushPlugin"/>
				<param name="android-package" value="com.adobe.phonegap.push.PushPlugin"/>
			</feature>
		</config-file>

@@ -47,22 +47,22 @@
		</config-file>

		<config-file target="AndroidManifest.xml" parent="/manifest/application">
			<activity android:name="com.plugin.gcm.PushHandlerActivity" android:exported="true"/>
			<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
			<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true"/>
			<receiver android:name="com.adobe.phonegap.push.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
				<intent-filter>
					<action android:name="com.google.android.c2dm.intent.RECEIVE" />
					<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
					<category android:name="$PACKAGE_NAME" />
				</intent-filter>
			</receiver>
			<service android:name="com.plugin.gcm.GCMIntentService" />
			<service android:name="com.adobe.phonegap.push.GCMIntentService" />
		</config-file>

		<source-file src="src/android/libs/gcm.jar" target-dir="libs/" />
		<source-file src="src/android/com/plugin/gcm/CordovaGCMBroadcastReceiver.java" target-dir="src/com/plugin/gcm/" />
		<source-file src="src/android/com/plugin/gcm/GCMIntentService.java" target-dir="src/com/plugin/gcm/" />
		<source-file src="src/android/com/plugin/gcm/PushHandlerActivity.java" target-dir="src/com/plugin/gcm/" />
		<source-file src="src/android/com/plugin/gcm/PushPlugin.java" target-dir="src/com/plugin/gcm/" />
		<source-file src="src/android/com/plugin/gcm/CordovaGCMBroadcastReceiver.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/plugin/gcm/GCMIntentService.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/plugin/gcm/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/plugin/gcm/PushPlugin.java" target-dir="src/com/adobe/phonegap/push/" />
		<source-file src="src/android/com/plugin/android-support-v13.jar" target-dir="libs/" />

	</platform>
+2 −2
Changes for src/android/com/plugin/gcm/CordovaGCMBroadcastReceiver.java: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
package com.plugin.gcm;
package com.adobe.phonegap.push;

import android.content.Context;

@@ -13,7 +13,7 @@ public class CordovaGCMBroadcastReceiver extends GCMBroadcastReceiver {
	
	@Override
	protected String getGCMIntentServiceClassName(Context context) {
    	return "com.plugin.gcm" + DEFAULT_INTENT_SERVICE_CLASS_NAME;
    	return "com.adobe.phonegap.push" + DEFAULT_INTENT_SERVICE_CLASS_NAME;
    }
	
}
 No newline at end of file
+7 −18
Changes for src/android/com/plugin/gcm/GCMIntentService.java: 7 added lines, 18 removed lines.
Original line number Diff line number Diff line
package com.plugin.gcm;
package com.adobe.phonegap.push;

import org.json.JSONException;
import org.json.JSONObject;
@@ -29,18 +29,14 @@ public class GCMIntentService extends GCMBaseIntentService {

		Log.v(LOG_TAG, "onRegistered: "+ regId);

		JSONObject json;

		try {
			json = new JSONObject();
			json.put("registrationId", regId);
	        JSONObject json = new JSONObject().put("registrationId", regId);

			Log.v(LOG_TAG, "onRegistered: " + json.toString());

			PushPlugin.sendEvent( json );
		}
		catch( JSONException e)
		{
		catch(JSONException e) {
			// No message to the user is sent, JSON failed
			Log.e(LOG_TAG, "onRegistered: JSON exception");
		}
@@ -57,8 +53,7 @@ public class GCMIntentService extends GCMBaseIntentService {

		// Extract the payload from the message
		Bundle extras = intent.getExtras();
		if (extras != null)
		{
		if (extras != null) {
			// if we are in the foreground, just surface the payload, else post it to the statusbar
            if (PushPlugin.isInForeground()) {
				extras.putBoolean("foreground", true);
@@ -75,8 +70,7 @@ public class GCMIntentService extends GCMBaseIntentService {
        }
	}

	public void createNotification(Context context, Bundle extras)
	{
	public void createNotification(Context context, Bundle extras) {
		NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
		String appName = getAppName(this);

@@ -131,13 +125,8 @@ public class GCMIntentService extends GCMBaseIntentService {
		mNotificationManager.notify((String) appName, notId, mBuilder.build());
	}
	
	private static String getAppName(Context context)
	{
		CharSequence appName = 
				context
					.getPackageManager()
					.getApplicationLabel(context.getApplicationInfo());
		
	private static String getAppName(Context context) {
		CharSequence appName =  context.getPackageManager().getApplicationLabel(context.getApplicationInfo());
		return (String)appName;
	}
	
+4 −8
Changes for src/android/com/plugin/gcm/PushHandlerActivity.java: 4 added lines, 8 removed lines.
Original line number Diff line number Diff line
package com.plugin.gcm;
package com.adobe.phonegap.push;

import android.app.Activity;
import android.app.NotificationManager;
@@ -19,8 +19,7 @@ public class PushHandlerActivity extends Activity
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.v(LOG_TAG, "onCreate");

@@ -38,8 +37,7 @@ public class PushHandlerActivity extends Activity
	 * Takes the pushBundle extras from the intent, 
	 * and sends it through to the PushPlugin for processing.
	 */
	private void processPushBundle(boolean isPushPluginActive)
	{
	private void processPushBundle(boolean isPushPluginActive) {
		Bundle extras = getIntent().getExtras();

		if (extras != null)	{
@@ -55,8 +53,7 @@ public class PushHandlerActivity extends Activity
	/**
	 * Forces the main activity to re-launch if it's unloaded.
	 */
	private void forceMainActivityReload()
	{
	private void forceMainActivityReload() {
		PackageManager pm = getPackageManager();
		Intent launchIntent = pm.getLaunchIntentForPackage(getApplicationContext().getPackageName());    		
		startActivity(launchIntent);
@@ -68,5 +65,4 @@ public class PushHandlerActivity extends Activity
        final NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.cancelAll();
    }

}
 No newline at end of file
+1 −1
Changes for src/android/com/plugin/gcm/PushPlugin.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
package com.plugin.gcm;
package com.adobe.phonegap.push;

import android.app.NotificationManager;
import android.content.Context;