當前位置: 首頁>>代碼示例>>Java>>正文


Java TiApplication.getApplicationContext方法代碼示例

本文整理匯總了Java中org.appcelerator.titanium.TiApplication.getApplicationContext方法的典型用法代碼示例。如果您正苦於以下問題:Java TiApplication.getApplicationContext方法的具體用法?Java TiApplication.getApplicationContext怎麽用?Java TiApplication.getApplicationContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.appcelerator.titanium.TiApplication的用法示例。


在下文中一共展示了TiApplication.getApplicationContext方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clearSchedule

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@Kroll.method
public void clearSchedule() {
    TiApplication app = TiApplication.getInstance();

    int ntfCount = app.getAppProperties().getInt(PROPERTY_NOTIFICATION_COUNTER, 0);

    Log.d(TAG, "Clearing " + ntfCount + " notifications");

    if(ntfCount > 0) {
        Intent intent = new Intent(app.getApplicationContext(), NotificationPublisher.class);
        for(int i = 0; i < ntfCount; i++) {
            PendingIntent pendingIntent = PendingIntent.getBroadcast(app.getApplicationContext(), i, intent, PendingIntent.FLAG_ONE_SHOT);
            AlarmManager alarmManager = (AlarmManager)app.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
            alarmManager.cancel(pendingIntent);
            pendingIntent.cancel();
        }

        app.getAppProperties().setInt(PROPERTY_NOTIFICATION_COUNTER, 0);
    }
}
 
開發者ID:a-voityuk,項目名稱:CTTimekoGCM,代碼行數:21,代碼來源:CttimekogcmModule.java

示例2: schedule

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
@Kroll.method
public void schedule(long time, HashMap data) {
    TiApplication app = TiApplication.getInstance();
    int ntfId = app.getAppProperties().getInt(PROPERTY_NOTIFICATION_COUNTER, 0);

    Log.d(TAG, "Scheduling notification " + ntfId + " at " + time);

    Intent intent = new Intent(app.getApplicationContext(), NotificationPublisher.class);
    intent.putExtra(PROPERTY_NOTIFICATION_DATA, data);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(app.getApplicationContext(), ntfId, intent, PendingIntent.FLAG_ONE_SHOT);

    AlarmManager alarmManager = (AlarmManager)app.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);

    app.getAppProperties().setInt(PROPERTY_NOTIFICATION_COUNTER, ntfId+1);
}
 
開發者ID:a-voityuk,項目名稱:CTTimekoGCM,代碼行數:17,代碼來源:CttimekogcmModule.java

示例3: EnablePush

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public static void EnablePush(TiApplication app) {
  Context appContext = app.getApplicationContext();
  Activity appActivity = app.getAppCurrentActivity();

  if (appContext == null) {
    Log.e(TAG, "Application context is null, can't initialize Parse");
    return;
  }
  else if (appActivity == null) {
    Log.e(TAG, "Application activity is null, can't initialize Parse");
    return;
  }
  else {
    //PushService.setDefaultPushCallback(appContext, appActivity.getClass());
    ParseAnalytics.trackAppOpened(appActivity.getIntent());
    ParseInstallation.getCurrentInstallation().saveInBackground();
  }
}
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:19,代碼來源:ParseSingleton.java

示例4: InitializeParse

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public void InitializeParse(String appId, String clientKey, TiApplication application) {
  Context appContext = application.getApplicationContext();

  if (appContext == null) {
    Log.e(TAG, "Application context is null, cannot continue...");
    return;
  }
  else if (appId != null && appId.isEmpty()) {
    Log.e(TAG, "Application key is required! Parse has NOT been initialized.");
    return;
  }
  else if (clientKey != null && clientKey.isEmpty()) {
    Log.e(TAG, "Client key is required! Parse has NOT been initialized.");
    return;
  }

  if (!initialized) {
    Log.d(TAG, "Initializing with: '" + appId + "' and '" + clientKey + "'.");
    Parse.initialize(appContext, appId, clientKey);

    initialized = true;
  }
  else
  {
    Log.e(TAG, "Parse has already been initialized!");
  }
}
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:28,代碼來源:ParseSingleton.java

示例5: InitializeParseWithConfig

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public void InitializeParseWithConfig(String appId, String clientKey, String serverUrl, TiApplication application) {
   Context appContext = application.getApplicationContext();

   if (appContext == null) {
     Log.e(TAG, "Application context is null, cannot continue...");
     return;
   } else if (appId != null && appId.isEmpty()) {
     Log.e(TAG, "Application key is required! Parse has NOT been initialized.");
     return;
   } else if (serverUrl != null && serverUrl.isEmpty()) {
  Log.e(TAG, "Server Url is required! Parse has NOT been initialized.");
  return;
}

   if (!initialized) {
     Log.d(TAG, "Initializing with: '" + appId + "' and '" + serverUrl + "'.");
     
     Parse.initialize(new Parse.Configuration.Builder(appContext)
       .applicationId(appId)
       .clientKey(null)
       .server(serverUrl)
       .build());

     initialized = true;
   }
   else
   {
     Log.e(TAG, "Parse has already been initialized!");
   }
}
 
開發者ID:E2010,項目名稱:android-parse-module-titanium-3-5,代碼行數:31,代碼來源:ParseSingleton.java

示例6: NotificationProxy

import org.appcelerator.titanium.TiApplication; //導入方法依賴的package包/類
public NotificationProxy() {
	super();
	
	TiApplication app = TiApplication.getInstance();
	mNotifyManager = (NotificationManager) app.getSystemService(Activity.NOTIFICATION_SERVICE);
	mBuilder = new NotificationCompat.Builder(app.getApplicationContext());
	makeOngoingProgress(0, true); // make progress bar indeterminate when 1st notify
}
 
開發者ID:azwan082,項目名稱:nc_progress_notification,代碼行數:9,代碼來源:NotificationProxy.java


注:本文中的org.appcelerator.titanium.TiApplication.getApplicationContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。