This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isMyServiceRunning(Class<?> serviceClass) { | |
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); | |
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | |
if (serviceClass.getName().equals(service.service.getClassName())) { | |
return true; | |
} | |
} | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.SharedPreferences; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.provider.Telephony; | |
import android.telephony.SmsMessage; | |
import android.util.Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean checkPlayServices() { | |
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); | |
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this); | |
if (resultCode != ConnectionResult.SUCCESS) { | |
if (apiAvailability.isUserResolvableError(resultCode)) { | |
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST) | |
.show(); | |
} else { | |
Log.i(TAG, "This device is not supported."); | |
finish(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ':app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class SunshineWeatherUtils { | |
private final static String TAG = SunshineWeatherUtils.class.getSimpleName(); | |
public static String formatTemperature(Context context, double temperature) { | |
int temperatureFormatResourceId = R.string.format_temperature; | |
return String.format(context.getString(temperatureFormatResourceId), temperature); | |
} | |
public static int getSmallArtResourceIdForWeatherCondition(int weatherId) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Temperature format --> | |
<string name="format_temperature"> | |
<xliff:g id="temp">%1.0f</xliff:g>\u00B0 | |
</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getReadableTime(){ | |
Date date = new Date(dt * 1000L); | |
DateFormat format = new SimpleDateFormat("MMM dd"); | |
return format.format(date); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express().use(bodyParser.json()); | |
var request = require('request'); | |
app.post('/paypal-webhooks', (req, res) => { | |
var summary = req.body.summary; | |
var fee = req.body.resource.transaction_fee.value; | |
var id = req.body.resource.parent_payment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: jangrewe/gitlab-ci-android | |
stages: | |
- build | |
- test | |
before_script: | |
- export GRADLE_USER_HOME=$(pwd)/.gradle | |
- chmod +x ./gradlew |