Integrating Maps and Notifications via Nokia X Services SDK Introduction
The Nokia X platform bridges the gap between Android apps and Nokia’s specialized ecosystem. Developers can leverage the Nokia X Services SDK to replace Google Mobile Services (GMS) with Nokia’s proprietary alternatives. This guide demonstrates how to integrate two core components: HERE Maps and Nokia Notifications. Prerequisites
Before writing code, prepare your development environment and application manifest. 1. Library Dependencies
Add the Nokia X Services SDK stub libraries to your project compile path. Do not pack these stubs into your final APK. The actual implementation resides on the Nokia X device. 2. Manifest Configurations
Modify your AndroidManifest.xml file to request the required permissions and declare the use of Nokia services.
Use code with caution. Section 1: Implementing HERE Maps
The Nokia X Services SDK utilizes HERE Maps as its default mapping provider. 1. Initialize the Map Fragment
Embed the MapFragment into your activity layout XML or initialize it dynamically within your Java code.
import com.nokia.maps.common.GeoCoordinate; import com.nokia.maps.map.Map; import com.nokia.maps.map.MapFragment; public class MapActivity extends Activity { private Map map = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_map); MapFragment mapFragment = (MapFragment) getFragmentManager() .findFragmentById(R.id.mapfragment); mapFragment.init(new OnEngineInitListener() { @Override public void onEngineInitializationCompleted(Error error) { if (error == Error.NONE) { map = mapFragment.getMap(); // Center map on Helsinki, Finland map.setCenter(new GeoCoordinate(60.1699, 24.9384), Map.Animation.NONE); map.setZoomLevel(10); } else { Log.e(“MAP_ERROR”, “Cannot initialize MapFragment: ” + error); } } }); } } Use code with caution. Section 2: Implementing Nokia Push Notifications
Nokia Push Notifications replace Google Cloud Messaging (GCM). The architecture relies on a persistent connection between the Nokia device and Nokia’s push servers. 1. Register for Push Notifications
Call the registration method during app startup to obtain a unique registration ID.
import com.nokia.push.PushRegistrar; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Verify device compatibility PushRegistrar.checkDevice(this); PushRegistrar.checkManifest(this); // Register with the sender ID provided by Nokia Developer Portal final String regId = PushRegistrar.getRegistrationId(this); if (regId.equals(“”)) { PushRegistrar.register(this, “YOUR_SENDER_ID”); } else { Log.v(“Push”, “Already registered: ” + regId); } } } Use code with caution. 2. Handle Incoming Notifications
Create a broadcast receiver extending PushBaseReceiver to catch registration updates and incoming data payloads.
import android.content.Context; import android.content.Intent; import com.nokia.push.PushBaseReceiver; public class PushMessageReceiver extends PushBaseReceiver { @Override protected void onRegistered(Context context, String registrationId) { Log.i(“Push”, “Device registered: regId = ” + registrationId); // Send this ID to your custom application server } @Override protected void onUnregistered(Context context, String registrationId) { Log.i(“Push”, “Device unregistered”); } @Override protected void onMessage(Context context, Intent intent) { Log.i(“Push”, “New notification received”); String message = intent.getStringExtra(“payload_key”); // Trigger a local status bar notification or update UI } @Override protected void onError(Context context, String errorId) { Log.e(“Push”, “Registration error: ” + errorId); } } Use code with caution. Section 3: Interaction Workflow
Integrating both features allows the app to react dynamically to cloud stimuli.
The application server issues a targeted push notification containing geographic coordinates.
The PushMessageReceiver captures the payload on the Nokia X device.
The receiver passes the coordinates to the MapActivity via an intent.
The HERE Map camera smoothly animates to focus on the new location marker. Conclusion
Migrating to or targeting the Nokia X platform requires swapping GMS dependencies for the Nokia X Services SDK. By properly configuring the manifest file and initializing the HERE Maps engine and Nokia Push systems, you ensure full operational capability on Nokia X devices with minimal structural code alterations. If you want to refine this implementation, let me know: Your preferred build tool (Ant, Gradle, or Eclipse ADT)
If you need the server-side payload structure for the push service If you want to add customized map markers / overlays
I can provide the specific code snippets you need to proceed.