您可能需要嚮應用程序添加一些設置,這些設置存儲在原生Android範圍內的某個位置,並可從您的GCM通知接收器訪問它們。
看一看SharedPreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
例如:
//
// Save a shared preference
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences("YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE);
Editor preferencesEditor = sharedPreferences.edit();
preferencesEditor.putString("customNotificationSound", soundLocation);
preferencesEditor.commit();
在接收機
然後:
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences("YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE);
String soundLocation = sharedPreferences.getBoolean("customNotificationSound", false);