Skip to content

Instantly share code, notes, and snippets.

@acidjazz
Created February 14, 2013 20:08
Show Gist options
  • Save acidjazz/4955934 to your computer and use it in GitHub Desktop.
Save acidjazz/4955934 to your computer and use it in GitHub Desktop.
package com.rosetta.sms_sxsw;
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import org.apache.cordova.*;
import android.telephony.TelephonyManager;
import android.content.SharedPreferences;
import android.util.Log;
public class sms_sxsw extends DroidGap {
private static String imei;
public void onCreate(Bundle savedInstanceState) {
Intent i = getIntent();
final String action = i.getAction();
Log.w("ACTION", action);
// successfully detected a redirect
if (Intent.ACTION_VIEW.equals(action)) {
final List<String> segments = i.getData().getPathSegments();
Log.w("LISTARRAY", segments.toString());
}
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html")
// grab our IMEI
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
imei = tm.getDeviceId();
super.loadUrl("javascript:window.IMEI=\"" + imei + "\";");
// check for a referrer
SharedPreferences prefs = Context.getSharedPreferences("com.rosetta.sms_sxsw", Context.MODE_PRIVATE);
String referrer = prefs.getString("referrer", null);
if (referrer != null) {
Log.w("REFERRER", referrer);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment